C++: Advanced Features and Programming Techniques (Step-By-Step C++ Book 3) by Nathan Clark

C++: Advanced Features and Programming Techniques (Step-By-Step C++ Book 3) by Nathan Clark

Author:Nathan Clark [Clark, Nathan]
Language: eng
Format: azw3
Publisher: Nathan Clark
Published: 2017-10-28T04:00:00+00:00


Normally all code that could cause an exception will be placed in the try block. If an exception does occur, it will be caught in the catch block. It is in this block that we can carry out the relevant steps to ensure the program execution does not stop.

7.1 Throwing an Exception

Normally in the catch block we would throw an exception, which could then be caught by the main program. Sometimes we may not be able to decipher the actual exception that is thrown by the program. In these cases we can throw a general exception back to the calling program.

Let’s see an example of how to use the throw clause.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.